// pages/index/comps/homePop/homePop.js
const common = require('../../../../utils/util.js')
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        popImg: Object,
        homePop: Boolean
    },

    /**
     * 组件的初始数据
     */
    data: {

    },

    /**
     * 组件的方法列表
     */
    methods: {
        myCatchTouch: function () {
            return
        },

        goLink: function (e) {
            if (wx.getStorageSync('token')) {
                let data = {
                    form_id: e.detail.formId
                }
                common.post('User/up_form_id', data).then(function (res) {
                    console.log(res)
                }).catch(function (e) {})
            }
            if (e.currentTarget.dataset.link) {
                wx.navigateTo({
                    url: e.currentTarget.dataset.link
                })
            }
            this.triggerEvent('closePop')
        },

        goClose: function (e) {
            let data = {
                form_id: e.detail.formId
            }
            if (wx.getStorageSync('token')) {
                common.post('User/up_form_id', data).then(function (res) {
                    console.log(res)
                }).catch(function (e) {})
            }
            this.triggerEvent('closePop')
        },

        closePop: function () {
            this.triggerEvent('closePop')
        }
    }
})